import request from '@/utils/request'

// 查询考勤记录列表
export function listAttendance(query) {
  return request({
    url: '/manage/attendance/list',
    method: 'get',
    params: query
  })
}

// 查询考勤记录详细
export function getAttendance(attendanceId) {
  return request({
    url: '/manage/attendance/' + attendanceId,
    method: 'get'
  })
}

// 新增考勤记录
export function addAttendance(data) {
  return request({
    url: '/manage/attendance',
    method: 'post',
    data: data
  })
}

// 修改考勤记录
export function updateAttendance(data) {
  return request({
    url: '/manage/attendance',
    method: 'put',
    data: data
  })
}

// 删除考勤记录
export function delAttendance(attendanceId) {
  return request({
    url: '/manage/attendance/' + attendanceId,
    method: 'delete'
  })
}

// 查询所有考勤记录
export function allAttendance(query) {
  return request({
    url: '/manage/attendance/all',
    method: 'get',
    params: query
  })
}

// 查询近days考勤率
export function getDaysAttendanceRate(params) {
  return request({
    url: '/manage/attendance/days/attendanceRate',
    method: 'get',
    params: params
  })
}

// 按分类查询近days考勤率,分类选项包括：subject、class
export function getDaysAttendanceRateByType(params) {
  return request({
    url: '/manage/attendance/days/type/attendanceRate',
    method: 'post',
    params: params
  })
}

// 查看某条件下的近days天考勤数据统计，条件包括：subjectId、postId、deptId、studentId
export function getDaysAttendanceStatistics(params) {
  return request({
    url: '/manage/attendance/days/condition/statistics',
    method: 'post',
    params: params
  })
}